package com.example.flowable.service.impl;

import com.example.flowable.service.FlowService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.runtime.ProcessInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zkh
 * @date 2023-11-07
 * @desc
 */
@Service("flowService")
public class FlowServiceImpl implements FlowService {
    private static final Logger LOGGER = LoggerFactory.getLogger(FlowServiceImpl.class);
    @Autowired
    private RuntimeService runtimeService;

    @Override
    public Boolean startEngine() {
        List<String> userList = new ArrayList<>();
        userList.add("11111111");
        userList.add("22222222");
        Map<String, Object> values = new HashMap<>();
        values.put("opt",1);
        values.put("uploadUserList", userList);
//        values.put("opt",1);
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dmsPlusModel01",
                values);
        LOGGER.info(" =>", processInstance);
        return null;
    }
}
